package com.example.app2

import android.app.Service
import android.content.Intent
import android.os.IBinder
import com.example.sevicedemo.ILoginAidlInterface

class AIDL2Service : Service() {

    override fun onBind(intent: Intent): IBinder {
        return MyBinder()
    }

    inner class MyBinder : ILoginAidlInterface.Stub() {
        override fun login() {
            execLogin();
        }


        override fun loginCallback(loginStatus: Int, loginUser: String?) {
            println("AIDL2Service MyBinder.loginCallback loginStatus=$loginStatus loginUser=$loginUser")
        }

    }

    private fun execLogin() {
        // 调起登录页面
        val intent = Intent(this, LoginActivity::class.java)
        intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
        startActivity(intent)
    }


}